Fix build with old cups
authorMatthias Clasen <matthiasc@src.gnome.org>
Mon, 11 Aug 2008 19:59:50 +0000 (19:59 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Mon, 11 Aug 2008 19:59:50 +0000 (19:59 +0000)
svn path=/trunk/; revision=21079

ChangeLog
modules/printbackends/cups/gtkcupsutils.c
modules/printbackends/cups/gtkcupsutils.h

index 4da2de8af3f8efb635ec4d49b8b38639743b1f75..3d68b26e402b60bca3c38065b00014a24c4ada88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-08-11  Matthias Clasen  <mclasen@redhat.com>
+
+       Bug 546616 – CUPS print backend uses 1.2 API without guards
+
+       * modules/printbackends/cups/gtkcupsutils.[hc]: Make use
+       of cups 1.2 api dependent on the HAVE_CUPS_1_2 define.
+       Patch by Sven Herzberg and Richard Hult
+
 2008-08-11  Michael Natterer  <mitch@imendio.com>
 
        Bug 547270 – Make GtkHSV public
index d11653b359b6026d1fffe9a8b956027cf59f9630..8abe8021e42d6a92780ce5f93813d6e9f3ab4aa5 100644 (file)
@@ -1204,6 +1204,7 @@ GtkCupsConnectionTest *
 gtk_cups_connection_test_new (const char *server)
 {
   GtkCupsConnectionTest *result = NULL;
+#ifdef HAVE_CUPS_API_1_2
   gchar                 *port_str = NULL;
 
   result = g_new (GtkCupsConnectionTest, 1);
@@ -1222,6 +1223,9 @@ gtk_cups_connection_test_new (const char *server)
   result->success_at_init = FALSE;
 
   result->success_at_init = gtk_cups_connection_test_is_server_available (result);
+#else
+  result = g_new (GtkCupsConnectionTest, 1);
+#endif
 
   return result;
 }
@@ -1235,6 +1239,7 @@ gtk_cups_connection_test_new (const char *server)
 gboolean 
 gtk_cups_connection_test_is_server_available (GtkCupsConnectionTest *test)
 {
+#ifdef HAVE_CUPS_API_1_2
   http_addrlist_t *iter;
   gboolean         result = FALSE;
   gint             flags;
@@ -1295,6 +1300,9 @@ gtk_cups_connection_test_is_server_available (GtkCupsConnectionTest *test)
 
       return result;
     }
+#else
+  return TRUE;
+#endif
 }
 
 /* This function frees memory used by the GtkCupsConnectionTest structure.
@@ -1305,6 +1313,7 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test)
   if (test == NULL)
     return;
 
+#ifdef HAVE_CUPS_API_1_2
   test->current_addr = NULL;
   httpAddrFreeList (test->addrlist);
   if (test->socket != -1)
@@ -1312,5 +1321,6 @@ gtk_cups_connection_test_free (GtkCupsConnectionTest *test)
       close (test->socket);
       test->socket = -1;
     }
+#endif
   g_free (test);
 }
index 7dfe387f91cf88cc8fcbd8b15cfe6454b880fd5d..a6314bb8a5235d89b99a2500d300e496feb635a4 100644 (file)
@@ -83,10 +83,12 @@ struct _GtkCupsRequest
 
 struct _GtkCupsConnectionTest
 {
+#ifdef HAVE_CUPS_API_1_2
   http_addrlist_t *addrlist;
   http_addrlist_t *current_addr;
   gboolean         success_at_init;
   gint             socket;
+#endif
 };
 
 #define GTK_CUPS_REQUEST_START 0